package Stringlei;

public class String5 {
    public static void main(String[] args) {
        char[] chars = "I love China".toCharArray();//将字符串转化为字符数组
        for (int i = 0; i < chars.length; i++) {
            System.out.print(chars[i]);
        }

        byte[] bytes = "I love China".getBytes();//将字符串转化为字节数组
        for (int i = 0; i < bytes.length; i++) {
            System.out.println(bytes[i]);
        }

        String str1 = "I love CHINA";
        String str2 = str1.replace("HINA","hina");//将str1里的HINA替换为hina
        System.out.println(str1);
        System.out.println(str2);
    }
}
